Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

714
Vistas
Undefined array key "id". Laravel 8 send:notification command

I am trying to send a notification to the enrolled users in an event a day before the event's start date. I have a user table events table that contains the start date of each event. Also, I have an enrollment table that includes the user_id and event_id as foreign keys and the start date of these events. However, while I was trying to code the logic of this function and executing it, I got this error.

class SendNotification extends Command

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You are using collection when you call Model::all() and you are trying to use it like an array but it is a collection.

$enrolls = Enroll::all()->keyBy('user_id')->all();

then run your if check like

if (isset($enrolls[$user->id]))

I can not copy your code because you shared screenshot not a code. So be aware of that for your next question.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda